<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="John Doe">





<title>Copilot初体验 | Wikiq</title>



    <link rel="icon" href="/yinghua.png">




    <!-- stylesheets list from _config.yml -->
    
    <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
    <script src="/js/script.js"></script>
    
    <script src="/js/tocbot.min.js"></script>
    



    
    
        
    


<meta name="generator" content="Hexo 5.4.2"></head>

<body>
    <script>
        // this function is used to check current theme before page loaded.
        (() => {
            const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
            const isDark = currentTheme === 'dark';
            const pagebody = document.getElementsByTagName('body')[0]
            if (isDark) {
                pagebody.classList.add('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Dark"
            } else {
                pagebody.classList.remove('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Light"
            }
        })();
    </script>

    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">Wikiq</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/like">Like</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/about">About</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">Wikiq</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/like">Like</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/about">About</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
            <div class="main">
                <div class="container">
    
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">Copilot初体验</h1>
            
                <div class="post-meta">
                    
                        Author: <a itemprop="author" rel="author" href="/">John Doe</a>
                    

                    
                        <span class="post-time">
                        Date: <a href="#">April 15, 2022&nbsp;&nbsp;23:52:12</a>
                        </span>
                    
                    
                </div>
            
        </header>

        <div class="post-content">
            <p>AI、Artificial Intelligence、人工智能，已经家喻户晓了。手机上的“小爱同学”、Siri，电脑上的“Cortana小娜”，还有什么智能音箱，甚至各种信息流App例如某头条、某音里的“猜你喜欢”，都是AI的现实应用。</p>
<p>GitHub Copilot是一款基于AI的、应用于写程序场景的工具，其作用是在程序员写程序的过程中，帮忙写出接下来的一句或者一段代码。我等了两天便等到了测试资格，赶快上手体验了两个小时。下面这个是用时 <strong>7秒</strong> 完成的，你没看错，是<strong>七秒</strong>。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> mount3;</span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">halo</span> &#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        java.util.<span class="type">Date</span> <span class="variable">date</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">java</span>.util.Date();</span><br><span class="line">        System.out.println(date);</span><br><span class="line">        <span class="comment">//输出main1的结果</span></span><br><span class="line">        main1(args);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//写一个测试性别的类</span></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title function_">main1</span><span class="params">(String[] args)</span> &#123;</span><br><span class="line">        <span class="type">Person</span> <span class="variable">person</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">Person</span>();</span><br><span class="line">        person.setName(<span class="string">&quot;张三&quot;</span>);</span><br><span class="line">        person.setAge(<span class="number">99</span>);</span><br><span class="line">        person.setSex(<span class="string">&quot;男&quot;</span>);</span><br><span class="line">        System.out.println(person.getName() + <span class="string">&quot; &quot;</span> + person.getAge() + <span class="string">&quot; &quot;</span> + person.getSex());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>下图是官方的一个展示，一开始只写了一句话注释表明我想干什么，然后Copilot自己便生成了一整段正确的代码。（网站上的展示有很多，大家可以上 <a target="_blank" rel="noopener" href="https://copilot.github.com/">https://copilot.github.com</a> 自行观看）</p>
<p>最开始看到官方一些展示和国外的评测的时候，我感觉虽然很惊艳但是对我不太有用，毕竟我既不会用英文写注释，也不会用英文去表达一个函数方法名。</p>
<p>但在两个小时的体验中，我持续不断地经受着视觉冲击，不断在心里涌现出“天啊”“这也行”“太可怕了”的感受。</p>
<p>在上图里，都是要我先用各种方式——无论是注释还是函数名——描述自己接下来想做什么，然后它给出建议。这让我觉得有点刻意和割裂感，可能是因为我习惯先写代码后写注释。</p>
<p>但实际体验完全不止这样：它在我停止敲键盘的任何一刻，就给出了接下来的对本行代码内容补全的建议；亦或在我敲下回车的时候，就给出了下一行的代码内容；亦或是我先写了几行代码，然后想再写类似的、换了个别词语的几行，它就能直接给出来。</p>
<p>这便是视觉冲击所在，只要我停下来，它就会蹦出来它认为我接下来想写的内容，而且延迟基本不会慢于我的思考速度。最让人震惊的是，它帮我写的内容70、80%是我想要的，甚至还有备选项的功能，如果不是我想要的结果还能再换一个。</p>

        </div>

        
            <section class="post-copyright">
                
                    <p class="copyright-item">
                        <span>Author:</span>
                        <span>John Doe</span>
                    </p>
                
                
                    <p class="copyright-item">
                        <span>Permalink:</span>
                        <span><a href="http://example.com/2022/04/15/copilot/">http://example.com/2022/04/15/copilot/</a></span>
                    </p>
                
                
                    <p class="copyright-item">
                        <span>License:</span>
                        <span>Copyright (c) 2022 <a target="_blank" rel="noopener" href="http://qiwensong.top">CC-BY-NC-4.0</a> LICENSE</span>
                    </p>
                
                
                     <p class="copyright-item">
                         <span>Slogan:</span>
                         <span>Do you believe in <strong>DESTINY</strong>?</span>
                     </p>
                

            </section>
        
        <section class="post-tags">
            <div>
                <span>Tag(s):</span>
                <span class="tag">
                    
                    
                        <a href="/tags/free-up/"># free-up</a>
                    
                        
                </span>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
                <span>· </span>
                <a href="/">home</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2022/04/16/k8s%E7%9B%B8%E5%85%B3%E7%BB%83%E4%B9%A0/">k8s相关练习</a>
            
            
            <a class="next" rel="next" href="/2022/04/15/hello-world/">Hello World</a>
            
        </section>


    </article>
</div>

            </div>
            <footer id="footer" class="footer">
    <div class="copyright">
        <span>© John Doe | Powered by <a href="https://hexo.io" target="_blank">Hexo</a> & <a href="https://github.com/Siricee/hexo-theme-Chic" target="_blank">Chic</a></span>
    </div>
</footer>

    </div>
</body>

</html>